<?php /* Smarty version 2.6.18, created on 2009-10-31 15:26:07
         compiled from catchsummaryresult.tpl */ ?>
<div id="blanket" style="display:none;"></div>
<div id="download" style="position:absolute;background-color:#fff;width:400px;z-index: 1002;display:none;">
</div>
<div id="detail">
<table border="1" width="100%">
	<tr>
		<td>Fishery Management Area</td>
		<td>Fisher</td>
		<td>Month/Year</td>
		<td>Moid</td>
		<td>Scientific Name</td>
		<td>Common Name</td>
		<?php if ($this->_tpl_vars['param']['nocaught']): ?>
		<td># Caught</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['doa']): ?>
		<td>DOA</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['percentdoa']): ?>
		<td>% DOA</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['reject']): ?>
		<td>Reject</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['percentreject']): ?>
		<td>% Reject</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['approaching']): ?>
		<td>Species approaching<br>90% TAC</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['taclimit']): ?>
		<td>Species that reached TAC Limit</td>
		<?php endif; ?>
	</tr>
	<?php $this->assign('tcaught', 0); ?>
	<?php $this->assign('trject', 0); ?>
	<?php $this->assign('tdoa', 0); ?>
	<?php $this->assign('taclimit', 0); ?>
	<?php $this->assign('tacpercent', 0); ?>
	<?php $_from = $this->_tpl_vars['results']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }if (count($_from)):
    foreach ($_from as $this->_tpl_vars['data']):
?>
		<?php $this->assign('pdoa', $this->_tpl_vars['data']['doa']/$this->_tpl_vars['data']['caught']); ?>
		<?php $this->assign('preject', $this->_tpl_vars['data']['reject']/$this->_tpl_vars['data']['caught']); ?>
		<?php $this->assign('pdoas', $this->_tpl_vars['pdoa']*100); ?>
		<?php $this->assign('prejects', $this->_tpl_vars['preject']*100); ?>
		<?php $this->assign('tcaught', $this->_tpl_vars['tcaught']+$this->_tpl_vars['data']['caught']); ?>
		<?php $this->assign('treject', $this->_tpl_vars['treject']+$this->_tpl_vars['data']['reject']); ?>
		<?php $this->assign('tdoa', $this->_tpl_vars['tdoa']+$this->_tpl_vars['data']['doa']); ?>
		
		<tr>
			<td><?php echo $this->_tpl_vars['data']['FMA']; ?>
</td>
			<td><?php echo $this->_tpl_vars['data']['fishersName']; ?>
</td>
			<td><?php echo $this->_tpl_vars['data']['mymonth']; ?>
/<?php echo $this->_tpl_vars['data']['myyear']; ?>
</td>
			<td><?php echo $this->_tpl_vars['data']['moid']; ?>
</td>
			<td><?php echo $this->_tpl_vars['data']['scientific_name']; ?>
</td>
			<td><?php echo $this->_tpl_vars['data']['common_name']; ?>
</td>
			<?php if ($this->_tpl_vars['param']['nocaught']): ?>
			<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['data']['caught']; ?>
</td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['doa']): ?>
			<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['data']['doa']; ?>
</td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['percentdoa']): ?>
			<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['pdoas']; ?>
</td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['reject']): ?>
			<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['data']['reject']; ?>
</td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['percentreject']): ?>
			<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['prejects']; ?>
</td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['approaching']): ?>
				<td align="center"><?php if ($this->_tpl_vars['data']['tacpercent'] >= 90): ?><?php $this->assign('tacpercent', $this->_tpl_vars['tacpercent']+1); ?>Y<?php endif; ?></td>
			<?php endif; ?>
			<?php if ($this->_tpl_vars['param']['taclimit']): ?>
				<td align="center"><?php if ($this->_tpl_vars['data']['taclimit']): ?><?php $this->assign('taclimit', $this->_tpl_vars['taclimit']+1); ?>Y<?php endif; ?></td>
			<?php endif; ?>
		</tr>
	<?php endforeach; endif; unset($_from); ?>
	<tr>
		
		<td colspan="6"></td>
		<?php if ($this->_tpl_vars['param']['nocaught']): ?>
		<td><?php echo $this->_tpl_vars['tcaught']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['doa']): ?>
		<td  align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['tdoa']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['percentdoa']): ?>
		<?php $this->assign('tpdoa', $this->_tpl_vars['tdoa']/$this->_tpl_vars['tcaught']*100); ?>
		<td  align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['tpdoa']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['reject']): ?>
		<td  align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['treject']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['percentreject']): ?>
		<?php $this->assign('tpreject', $this->_tpl_vars['treject']/$this->_tpl_vars['tcaught']*100); ?>
		<td  align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['tpreject']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['approaching']): ?>
		<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['tacpercent']; ?>
</td>
		<?php endif; ?>
		<?php if ($this->_tpl_vars['param']['taclimit']): ?>
		<td align="right" style="padding-right:5px"><?php echo $this->_tpl_vars['taclimit']; ?>
</td>
		<?php endif; ?>
		
	</tr>
</table>
</div>
<table border="0" width="100%">
	<tr>
		<td><input type="button" value="Save to Excel" onclick="savetoexcel();">&nbsp;&nbsp;<input type="button" value="Print" onclick="print_me();"></td>
	</tr>
</table>
<script language="javascript">
<?php echo '

	function savetoexcel(){
		//openWindow("/admin/savecatch/",\'save\',570,390,\'scrollbars=yes\');
		doajaxAction("/admin/savecatch",0,\'download\');
		popup("download");
	}
	
	function print_me(){
		htmldata = document.getElementById(\'detail\').innerHTML;
		
		win = openWindowret(\'\',\'email\',570,390, \'scrollbars=yes\');
		win.document.open();
		win.document.write("<html><body onload=\'window.print();\'>");
		win.document.write("<form name=\'frm_element\' method=\'POST\'");
		win.document.write(htmldata);
		win.document.write(\'</form>\');
		win.document.write("</body></html>");
		win.document.close();
	}
'; ?>

</script>